package com.xneure.database.sql;

import org.springframework.stereotype.Component;
import com.xneure.database.sql.handler.HandlerType;
import com.xneure.database.sql.handler.SqlHandler;
@Component
public class GeneralMappingParser extends QueryMappingParser{
	public String update(Object obj,String where){
		SqlHandler sqlHandler = getHandler(HandlerType.UPDATE,obj.getClass());
		sqlHandler.resetParam();
		sqlHandler.build(obj);
		sqlHandler.addWhere(where);
		return sqlHandler.getSql();
	}

	public String delete(Object obj,String where){
		SqlHandler sqlHandler = getHandler(HandlerType.DELETE,obj.getClass());
		sqlHandler.resetParam();
		sqlHandler.build(obj);
		sqlHandler.addWhere(where);
		return sqlHandler.getSql();
	}

	public String insert(Object obj){
		SqlHandler sqlHandler = getHandler(HandlerType.INSERT,obj.getClass());
		sqlHandler.resetParam();
		sqlHandler.build(obj);
		return sqlHandler.getSql();
	}
}
